import 'package:banyou_app/app/config/colors.dart';
import 'package:banyou_app/app/modules/tabbat/controllers/tabbat_controller.dart';
import 'package:banyou_app/app/routes/app_pages.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';

class MangDialogView extends StatefulWidget {
  final String title;
  const MangDialogView(this.title);

  @override
  State<MangDialogView> createState() => _MangDialogViewState();
}

class _MangDialogViewState extends State<MangDialogView> {
  @override
  Widget build(BuildContext context) {
    return UnconstrainedBox(
      child: Container(
          width: 1.sw - 50,
          height: (1.sw - 50) * 312 / 343,
          decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(Radius.circular(10.r))),
          child: Stack(
            children: [
              Positioned.fill(
                child: Column(
                  children: [
                    Image.asset(
                      'assets/images/组 533@2x.png',
                      width: 1.sw - 50,
                      height: (1.sw - 50) * 138.69 / 343,
                    ),
                    const SizedBox(height: 20),
                    Expanded(
                      child: Container(
                        padding: EdgeInsets.symmetric(horizontal: 20),
                        child: Text(widget.title,
                            textAlign: TextAlign.center,
                            style: TextStyle(
                              fontSize: 15.sp,
                              fontWeight: FontWeight.w500,
                              color: ColorConfig.text_label,
                            )),
                      ),
                    ),
                    const SizedBox(height: 20),
                    InkWell(
                      child: Container(
                        width: 211.w,
                        height: 45,
                        decoration: BoxDecoration(
                          gradient: LinearGradient(
                              begin: Alignment.centerLeft,
                              end: Alignment.centerRight,
                              colors: [
                                Color(0xFFF52EC5),
                                Color(0xFFFF8A33),
                              ]),
                          borderRadius: BorderRadius.circular(20),
                        ),
                        child: Center(
                          child: Text(
                            "好的",
                            style: TextStyle(
                                color: ColorConfig.white,
                                fontSize: 16,
                                fontWeight: FontWeight.w500),
                          ),
                        ),
                      ),
                      onTap: () {
                        Get.until(
                            (route) => route.settings.name == Routes.TABBAT);
                        Get.find<TabbatController>().changePage(2);
                      },
                    ),
                    const SizedBox(height: 20),
                  ],
                ),
              ),
              Positioned(
                  top: 15,
                  right: 15,
                  child: InkWell(
                    onTap: () {
                      Get.back();
                    },
                    child: Image.asset(
                      'assets/images/路径 275@2x.png',
                      width: 20.r,
                    ),
                  ))
            ],
          )),
    );
  }
}
